<?php
/**
 * 大文件读写操作
 */
$file = '/mnt/c/Users/zen/Desktop/access.center.play800.cn.log';

//方法一
//ini_set('memory_limit', -1);
//$data = file($file);
//$line = $data[count($data)-1];
//echo $line;


//方法二
//$file = escapeshellarg($file);
//$line = `tail -n 1 $file`;
//echo $line;


//方法三
$fp = fopen($file, 'r');
$line = 1;
$pos = -2;
$t = '';
$data = '';
while ($line > 0)
{
    while ($t != "\n")
    {
        fseek($fp, $pos, SEEK_END);
        $t = fgetc($fp);
        $pos--;
    }
    $t = ' ';
    $data .= fgets($fp);
    $line--;
}
fclose($fp);
echo $data;